(function() {"use strict";var __module = CC_EDITOR ? module : {exports:{}};var __filename = 'preview-scripts/assets/js/playSceneScript.js';var __require = CC_EDITOR ? function (request) {return cc.require(request, require);} : function (request) {return cc.require(request, __filename);};function __define (exports, require, module) {"use strict";
cc._RF.push(module, '1e543S/ZiRHA7HQbunzv842', 'playSceneScript', __filename);
// js/playSceneScript.js

'use strict';

cc.Class({
    extends: cc.Component,

    properties: {
        getRole: cc.Animation,
        getBtn01: cc.Button,
        getBtn02: cc.Button
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad: function onLoad() {
        //绑定按钮事件：按下即触发
        this.getBtn01.node.on(cc.Node.EventType.TOUCH_START, this.btnClick, this);
        this.getBtn01.node.on(cc.Node.EventType.TOUCH_END, this.btnClick, this); //节点区域内离开
        this.getBtn01.node.on(cc.Node.EventType.TOUCH_CANCEL, this.btnClick, this); //节点区域外离开
        this.getBtn02.node.on(cc.Node.EventType.TOUCH_START, this.btnClick, this);
    },


    //按钮点击/touch事件
    btnClick: function btnClick(e) {
        if (this.getRole.currentClip && this.getRole.currentClip._name == 'role1-jump') {
            //判断当前是否有动作且为跳跃
            return; //避免跳跃时能够执行其他动作
        };
        if (e.target._name == 'btn-01' && e.type == 'touchstart') {
            this.getRole.play('role1-glide');
        } else if (e.target._name == 'btn-01' && (e.type == 'touchend' || e.type == 'touchcancel')) {
            this.getRole.play('role1-run');
        } else {
            //console.log(this.getRole.node);
            this.getRole.play('role1-jump');
            var moveUp = cc.moveTo(jumpDate / 2, cc.v2(jumpUpPos)).easing(cc.easeCubicActionOut());
            var moveDown = cc.moveTo(jumpDate / 2, cc.v2(roleDefaultPosition)).easing(cc.easeCubicActionIn());
            var callBack = cc.callFunc(this.jumpOver, this.getRole, this); //执行callBack函数，this是传入回调函数的数据
            var seq = cc.sequence(moveUp, moveDown, callBack); //顺序执行动作
            this.getRole.node.runAction(seq); //执行动作
        }
    },

    //跳跃完成之后callBack函数
    jumpOver: function jumpOver() {
        this.play('role1-run');
    }
    // start () {},

    // update (dt) {},

});

cc._RF.pop();
        }
        if (CC_EDITOR) {
            __define(__module.exports, __require, __module);
        }
        else {
            cc.registerModuleFunc(__filename, function () {
                __define(__module.exports, __require, __module);
            });
        }
        })();
        //# sourceMappingURL=playSceneScript.js.map
        